#include "DengueVirus.h"
DengueVirus::DengueVirus()
{
	cout<<"Constructor DengueVirus class"<<endl;
	DengueVirus::DoBorn();
	DengueVirus::InitResistance();
	
}
DengueVirus::DengueVirus(const DengueVirus &dengueVirus):Virus(dengueVirus)
{
	this->m_protein = new char[SIZE_PROTEIN];
	strcpy(this->m_protein,dengueVirus.m_protein);
	
}

DengueVirus::~DengueVirus()
{
	cout<<"Destructor DengueVirus!!!"<<endl;
	DengueVirus::DoDie();
	
}
void DengueVirus::DoBorn()
{

	Virus::LoadDNAInformation();
	this->m_protein = new char[SIZE_PROTEIN];
	switch(rand()%3)
	{
	case 0: strcpy(this->m_protein,"NS3");break;
	case 1: strcpy(this->m_protein,"NS5");break;
	case 2: strcpy(this->m_protein,"E5");break;
	}
}
list<Virus*> DengueVirus::DoClone()const
{
	list<Virus*> listDengueVirus;
	cout<<"DengueVirus clone"<<endl;
	for(int i = 0; i < 2; i++)
	{
		DengueVirus* vr = new DengueVirus(*this);
		listDengueVirus.push_back(vr);
	}
	
	return  listDengueVirus;
}
int DengueVirus::GetType()
{
	return DENGUEVIRUS;
}
void DengueVirus::DoDie()
{
	//delete m_protein;
	delete[] m_dna;
	delete[] m_protein;
	//delete m_protein;
	
}
void DengueVirus::InitResistance()
{	
	
	if(strcmp(this->m_protein,"NS3") == 0)
	{
		this->m_resistance = rand()%11 + 1;
	}else if(strcmp(this->m_protein,"NS5") == 0)
	{
		this->m_resistance = rand()%21 + 11;
	}else if(strcmp(this->m_protein,"E5") == 0)
	{
		this->m_resistance = rand()%31 + 21;
	}
	else this->m_resistance = 0;
}